package ylg.com.cn.beuty.base;

import android.annotation.SuppressLint;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.ImageView;
import android.widget.TextView;

import ylg.com.cn.beuty.R;

public abstract class BaseActivity extends AppCompatActivity {
	private static final int ACTIVITY_RESUME = 0;
	private static final int ACTIVITY_STOP = 1;
	private static final int ACTIVITY_PAUSE = 2;
	private static final int ACTIVITY_DESTROY = 3;
//sdfsdf
	public int activityd;
	// 是否允许全屏
	private boolean mAllowFullScreen = true;

	public abstract void findView();

	public abstract void init();

	public void setAllowFullScreen(boolean allowFullScreen) {
		this.mAllowFullScreen = allowFullScreen;
	}

	protected void setTitleTv(int id) {
		TextView tv = (TextView) findViewById(R.id.title_tv);
		tv.setText(id);
	}

	protected void setTitleTv(String str) {
		TextView tv = (TextView) findViewById(R.id.title_tv);
		tv.setText(str);
	}

//	protected void setBackTv(String str) {
//		TextView tv = (TextView) findViewById(R.id.back_tv);
//		tv.setText(str);
//	}

	protected void setNextTv(String str) {
		TextView tv = (TextView) findViewById(R.id.next_tv);
		tv.setVisibility(View.VISIBLE);
		tv.setText(str);
		View iv = findViewById(R.id.next_img);
		iv.setVisibility(View.GONE);
	}

	protected TextView getNextTv() {

		return (TextView) findViewById(R.id.next_tv);
	}

	protected void setBackGone() {
		View tv = findViewById(R.id.ly_back);
		tv.setVisibility(View.GONE);
	}

	public void back(View view) {
		finish();
	}

	@SuppressLint("NewApi")
	protected void setNextTvBG(Drawable drawable) {
		TextView tv = (TextView) findViewById(R.id.next_tv);
		tv.setBackground(drawable);
	}
	protected void setNextImage(int id) {
		TextView tv = (TextView) findViewById(R.id.next_tv);
		tv.setVisibility(View.GONE);
		ImageView iv= (ImageView) findViewById(R.id.next_img);
		iv.setVisibility(View.VISIBLE);
		iv.setImageResource(id);
	}
	protected void setNextOnClick(OnClickListener onClick) {
		TextView tv = (TextView) findViewById(R.id.next_tv);
		tv.setOnClickListener(onClick);
		View iv = findViewById(R.id.next_img);
		iv.setOnClickListener(onClick);
	}

	protected void setNextGone() {
		TextView tv = (TextView) findViewById(R.id.next_tv);
		tv.setVisibility(View.GONE);
		ImageView iv= (ImageView) findViewById(R.id.next_img);
		iv.setVisibility(View.GONE);
	}

	/***************************************************************************
	 * 
	 * 打印Activity生命周期
	 * 
	 ***************************************************************************/

	@Override
	protected void onCreate(Bundle savedInstanced) {
		super.onCreate(savedInstanced);
		// findView();
	}

}
